<%@ page language="java" contentType="text/html; charset=UTF-8"
pageEncoding="UTF-8"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
    <meta charset="UTF-8">
    <title>用户登录-厂房监控系统</title>
    <meta name="renderer" content="webkit|ie-comp|ie-stand">
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <meta name="viewport" content="width=device-width,user-scalable=yes, minimum-scale=0.4, initial-scale=0.8,target-densitydpi=low-dpi" />
    <meta http-equiv="Cache-Control" content="no-siteapp" />
    <link rel="stylesheet" href="resources/lib/css/xadmin.css">
    <script src="resources/lib/layui.js"></script>
    <script src="resources/lib/js/jquery-3.2.1.min.js"></script>
</head>
<body class="login-bg">

<div class="login">
    <div class="message">用户登录-厂房监控系统</div>
    <div id="darkbannerwrap"></div>

    <form method="post" class="layui-form">
        <input id="user_name" name="user_name" placeholder="用户名"  type="text" lay-verify="required" class="layui-input" >
        <hr class="hr25">
        <input id="user_password" name="user_password" lay-verify="required" placeholder="密码"  type="password" class="layui-input">

        <hr class="hr25">
        <input value="登录" lay-submit lay-filter="login" style="width:100%;" type="submit">
        <hr class="hr25">
    </form>
</div>
<script>
    $(function  () {
        layui.use('form', function(){
            var form = layui.form,$ = layui.$,element = layui.element;
            //layer.msg('玩命卖萌中', function(){
            //关闭后的操作
            //  });
            //监听提交
            form.on('submit(login)', function(data){
            	
            	var name = data.field.user_name ;
            	var pass = data.field.user_password ;
                $.ajax({
                    type:"post"
                    ,url:"loginA"
                    ,data:{user_name:name,user_password:pass}
                    ,success:function(data){
                        if(data == 'success'){
                            location.href="index?user_name=" + name ;
                        }else{
                            layer.msg("账户和密码不正确,请重新输入！");
                        }
                    }

                })

                return false;
            });
        });
    })
</script>
<!-- 底部结束 -->
</body>
</html>